<?php

/**
* HeaderModule.class.php
*
* Concrete page module responsable for creating page header
*
* @author     Blazej Zieba <b@zieba.info>
* @copyright  2007 konekto.com
* @version    CVS: $Id:$
*/

require_once("HTML/Template/IT.php");
require_once("framework/PageModule.class.php");
require_once("LocalizationModule.class.php");
require_once("framework/Wurfl.class.php");

// {{{ HeaderModule

class HeaderModule extends PageModule 
{
    // {{{ Class operations 

    // {{{ HeaderModule
    /**
    * C'tor
    */
    function HeaderModule()
    {
        trigger_error("ENTER HeaderModule::HeaderModule()", E_USER_NOTICE);
    }
    // }}}
    // {{{ getContent

    /**
    * Function returns page content
    *
    */

    function getContent()
    {
        trigger_error("ENTER HeaderModule::getContent()", E_USER_NOTICE);
        
        $template = &PEAR::getStaticProperty('CONFIG_INI','TEMPLATES'); 

        $tpl = new HTML_Template_IT($template['templates_dir']);

        $tpl->loadTemplatefile("header.tpl.xhtml",FALSE,FALSE);
        $tpl->setVariable("TITLE",_('Wirtualny Przewodnik'));
        $tpl->setVariable("ADMINPAGE",_('Dodaj trasę'));

        if ( Wurfl::isWireless() )
        {
            if ( Wurfl::isTouchscreen() ) 
            {
                $tpl->setVariable("CSSLINK",$template["css_link_touchscreen"]);
                $tpl->setVariable("CSSTITLE","touchscreen");
            }
            else
            {
                $tpl->setVariable("CSSLINK",$template["css_link_wireless"]);
                $tpl->setVariable("CSSTITLE","wireless");
            }
            $tpl->setVariable("SIMULATORSKIN",'');
        }
        else
        {
            $tpl->setVariable("CSSLINK",$template["css_link_desktop"]);
            $tpl->setVariable("CSSTITLE","desktop");
            $tpl->setVariable("SIMULATORSKIN",'<div id="skin"><div id="display">');
        }
        
        trigger_error("LEAVE HeaderModule::getContent()", E_USER_NOTICE);

        return $tpl->get(); 
    }
    
    // }}}

    // }}}
}

// }}} 

?>
